<div class="loader"></div>
<div class="row filter-form-container">
{{ Form::open(array('url' => $base, 'id' => 'form-filter')) }}
	<div class="form-group col-md-4">
		{{ Form::label('filter_payment_method', $text_payment_method) }}{{-- Added Field --}}
		{{ Form::select('filter_payment_method', Lang::get('topup.payment_method'), ( Input::get('filter_payment_method') ) ? Input::get('filter_payment_method') : 'points', array('class' => 'form-control')) }}{{-- Added Field --}}
		{{ Form::label('filter_order_status', $text_order_status) }}{{-- Added Field --}}
		{{ Form::select('filter_order_status', Lang::get('topup.order_status'), ( Input::get('filter_order_status') ) ? Input::get('filter_order_status') : '', array('class' => 'form-control')) }}{{-- Added Field --}}
		{{ Form::label('filter_topup_status', $text_topup_status) }}{{-- Added Field --}}
		{{ Form::select('filter_topup_status', Lang::get('topup.topup_status'), ( Input::get('filter_topup_status') ) ? Input::get('filter_topup_status') : '', array('class' => 'form-control')) }}{{-- Added Field --}}
		{{ Form::label('filter_client', $form_client) }}{{-- Added Field --}}
		{{ Form::select('filter_client', $companies, Input::get('filter_client'), array('class' => 'form-control')) }}{{-- Added Field --}}
		{{ Form::label('filter_by_date_ref', $form_date_ref) }}
		<p>From:</p>{{ Form::text('filter_date_ref_from', Input::get('filter_date_ref_from'), array('class' => 'form-control', 'placeholder' => 'From','id'=>'filter_date_ref_from')) }}{{-- Added Field --}}
		<p>To:</p>{{ Form::text('filter_date_ref_to', Input::get('filter_date_ref_to'), array('class' => 'form-control', 'placeholder' => 'To','id'=>'filter_date_ref_to')) }}{{-- Added Field --}}

	</div>
	<div class="form-group col-md-4">
		{{ Form::label('filter_employee_name', $text_employee_name) }}
		<p>{{ $text_firstname }}</p>
		<p>{{ Form::text('filter_employee_lastname', Input::get('filter_employee_lastname'), array('class' => 'form-control' , 'id'=>'filter_employee_lastname')) }}</p>
		
		<p>{{ $text_lastname }}</p>
		<p>{{ Form::text('filter_employee_firstname', Input::get('filter_employee_firstname'), array('class' => 'form-control', 'id'=>'filter_employee_firstname')) }}</p>
		<?php /*
		{{ Form::label('filter_employee_id', $text_employee_id) }}
		{{ Form::text('filter_employee_id', Input::get('filter_employee_id'), array('class' => 'form-control', 'id'=>'filter_employee_id')) }}
		*/ ?>
		{{ Form::label('filter_order_id', $text_filter_sales_order_id) }}
		{{ Form::textarea('filter_order_id', Input::get('filter_order_id'), array('size' => '70x5', 'placeholder' => $text_filter_line_separated )) }}
	</div>
	<div class="clearfix"></div>
	<div class="col-md-4">
	{{ HTML::link(URL::to($base), $text_filter, array('class' => 'btn btn-default', 'id'=> 'filter')) }}
	<input type="button" id="export_topup"class="btn btn-primary" value="{{ $list_export }}"></input>
	</div>
{{ Form::close() }}
</div>
<p>&nbsp;</p>
<table class="table table-bordered table-striped table-hover" id="topup_list">
  <thead>
    <tr>
		<td class="text-left"><a href="#" class="asc">{{ $list_id }}</a></td>  
		<td class="text-left"><a href="#" class="asc">{{ $list_lastname }}</a></td>
		<td class="text-left"><a href="#" class="asc">{{ $list_firstname }}</a></td>			
		<td class="text-left"><a href="#" class="asc">{{ $list_ORDER_id }}</a></td>
		<td class="text-left"><a href="#" class="asc">{{ $list_order_status }}</a></td>
		<td class="text-left"><a href="#" class="asc">{{ $list_company }}</a></td>
		<td class="text-left"><a href="#" class="asc">{{ $list_created_at }}</a></td>
		<td class="text-left"><a href="#" class="asc">{{ $list_payment_method }}</a></td>
		<td class="text-left"><a href="#" class="asc">{{ $list_topup_status }}</a></td> 
		<td class="text-right">{{ $list_action }}</td> 
    </tr>
  </thead> 
  <tbody>
	@foreach($results as $key=>$value)
	<tr>
		<td>{{ $value->id }}</td>
		<td>{{ $value->lastname }}</td>
		<td>{{ $value->firstname }}</td>
		<td>{{ $value->ORDER_id }}</td>
		<td>{{ $order_table_status[$value->order_status] }}</td>
		<td>{{ $value->name }}</td>
		<td>{{ strtotime($value->created_at) ? date_format($value->created_at,"m/d/Y H:i:s") : '-' }}</td>
		<td>{{ $payment_method[$value->payment_method] }}</td>
		<td>
			@if( $value->order_status == Constant::ORDER_PROCESSING)
			{{ $text_topup_approved }}
			@elseif($value->order_status == Constant::ORDER_CANCELLED)
			{{ $text_topup_cancelled }}
			@else
			{{ $topup_table_status[(int)$value->topup_status] }}	
			@endif
		</td>
		<td>
			@if( $value->order_status == Constant::ORDER_TOPUP )
			<a class="btn btn-info edit" href="{{ URL::to($base, array($value->id, 'edit')) }}" title="{{ $text_edit }}"><i class="fa fa-pencil"></i></a>
			@endif
		</td>			
	</tr>
	@endforeach  
  </tbody>
</table>

<div class="box-footer">
	<div class="col-xs-14 text-center">
		<div class="dataTables_info">Showing {{ $results->getFrom() }} to {{ $results->getTo() }} of {{ $results->getTotal() }} entries</div>
	</div>
	<div class="col-xs-14 text-center">
		<div class="no-margin">
		{{ $results->appends(Input::all())->links() }}
		</div>
	</div>
</div>

<script type="text/javascript">
$(function () {
	$('input[name="filter_date_ref_from"]').datetimepicker({format: 'M/D/YYYY'});
	$('input[name="filter_date_ref_to"]').datetimepicker({format: 'M/D/YYYY'});

	$("#export_topup").click(function(){

		self.location = '{{ URL::to("top-up") }}/export?' + $("#form-filter").serialize();
		
		});

});
</script>